package org.liurq.rabbitmq.service;


import org.liurq.rabbitmq.config.Constants;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderListener {


    /**
     * 京东订单处理
     * @param order 消息
     */
    @RabbitHandler
    @RabbitListener(queues = Constants.ORDER_JD)
    public void orderJdDeal (String order) {
        System.out.println(Constants.ORDER_JD + "==1==>" + order);
    }

    @RabbitHandler
    @RabbitListener(queues = Constants.ORDER_JD2)
    public void orderJdDeal2 (String order) {
        System.out.println(Constants.ORDER_JD2 + "==2==>" + order);
    }

    /**
     * 苏宁订单处理
     * @param order 消息
     */
    @RabbitHandler
    @RabbitListener(queues = Constants.ORDER_SN)
    public void orderSnDeal (String order) {
        System.out.println(Constants.ORDER_SN + "====>" + order);
    }

    /**
     * 淘宝订单处理
     * @param order 消息
     */
    @RabbitHandler
    @RabbitListener(queues = Constants.ORDER_TB)
    public void orderTbDeal (String order) {
        System.out.println(Constants.ORDER_TB + "====>" + order);
    }

    /**
     * 天猫订单处理
     * @param order 消息
     */
    @RabbitHandler
    @RabbitListener(queues = Constants.ORDER_TM)
    public void orderTmDeal (String order) {
        System.out.println(Constants.ORDER_TM + "====>" + order);
    }
}